<?php

/**
 * PhotoGroup filter form base class.
 *
 * @package    iEasy
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BasePhotoGroupFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'title'          => new sfWidgetFormFilterInput(),
      'brief'          => new sfWidgetFormFilterInput(),
      'source'         => new sfWidgetFormFilterInput(),
      'snapshot'       => new sfWidgetFormFilterInput(),
      'create_time'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'modify_time'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'celebrity_id'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Celebrity'), 'add_empty' => true)),
      'user_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Users'), 'add_empty' => true)),
      'hit_i'          => new sfWidgetFormFilterInput(),
      'hit_mask_i'     => new sfWidgetFormFilterInput(),
      'tag'            => new sfWidgetFormFilterInput(),
      'catalog_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Catalog'), 'add_empty' => true)),
      'sub_catalog_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Catalog_2'), 'add_empty' => true)),
      'keyword'        => new sfWidgetFormFilterInput(),
      'content_type_i' => new sfWidgetFormFilterInput(),
      'status_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Status'), 'add_empty' => true)),
      'member_level_i' => new sfWidgetFormFilterInput(),
      'num_of_photo_i' => new sfWidgetFormFilterInput(),
      'is_audit_b'     => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'capital_letter' => new sfWidgetFormFilterInput(),
      'system_user_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Systemuser'), 'add_empty' => true)),
      'is_header_b'    => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'is_recommend_b' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'is_on_top_b'    => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'is_focus_b'     => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'publish_time'   => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
    ));

    $this->setValidators(array(
      'title'          => new sfValidatorPass(array('required' => false)),
      'brief'          => new sfValidatorPass(array('required' => false)),
      'source'         => new sfValidatorPass(array('required' => false)),
      'snapshot'       => new sfValidatorPass(array('required' => false)),
      'create_time'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'modify_time'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'celebrity_id'   => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Celebrity'), 'column' => 'celebrity_id')),
      'user_id'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Users'), 'column' => 'user_id')),
      'hit_i'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'hit_mask_i'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'tag'            => new sfValidatorPass(array('required' => false)),
      'catalog_id'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Catalog'), 'column' => 'catalog_id')),
      'sub_catalog_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Catalog_2'), 'column' => 'catalog_id')),
      'keyword'        => new sfValidatorPass(array('required' => false)),
      'content_type_i' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'status_id'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Status'), 'column' => 'status_id')),
      'member_level_i' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'num_of_photo_i' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'is_audit_b'     => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'capital_letter' => new sfValidatorPass(array('required' => false)),
      'system_user_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Systemuser'), 'column' => 'system_user_id')),
      'is_header_b'    => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'is_recommend_b' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'is_on_top_b'    => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'is_focus_b'     => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'publish_time'   => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('photo_group_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'PhotoGroup';
  }

  public function getFields()
  {
    return array(
      'photo_group_id' => 'Number',
      'title'          => 'Text',
      'brief'          => 'Text',
      'source'         => 'Text',
      'snapshot'       => 'Text',
      'create_time'    => 'Date',
      'modify_time'    => 'Date',
      'celebrity_id'   => 'ForeignKey',
      'user_id'        => 'ForeignKey',
      'hit_i'          => 'Number',
      'hit_mask_i'     => 'Number',
      'tag'            => 'Text',
      'catalog_id'     => 'ForeignKey',
      'sub_catalog_id' => 'ForeignKey',
      'keyword'        => 'Text',
      'content_type_i' => 'Number',
      'status_id'      => 'ForeignKey',
      'member_level_i' => 'Number',
      'num_of_photo_i' => 'Number',
      'is_audit_b'     => 'Boolean',
      'capital_letter' => 'Text',
      'system_user_id' => 'ForeignKey',
      'is_header_b'    => 'Boolean',
      'is_recommend_b' => 'Boolean',
      'is_on_top_b'    => 'Boolean',
      'is_focus_b'     => 'Boolean',
      'publish_time'   => 'Date',
    );
  }
}
